﻿using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;

namespace Model.Public
{
    /// <summary>
    /// BaseClass 的摘要说明
    /// </summary>
    public partial interface BaseClass<T>
    {
        //get db name
        string GetDBName();

        //set db key
        void SetDBName(string hash_id);

        //get hash key
        int GetKey();

        //set hash key
        void SetKey(int key);

        ////get uid
        //int GetUID();

        /// 类 to 字典
        /// <summary>
        /// 类 to 字典
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Dictionary<string, object> ModelChangeToDic();

        /// 字典 to 类
        /// <summary>
        /// 字典 to 类
        /// </summary>
        /// <param name="dic"></param>
        /// <returns></returns>
        void DicChangeToModel(Dictionary<string, object> dic);


        /// 新增数据
        /// <summary>
        /// 新增数据
        /// </summary>
        /// <returns></returns>
        int InsertData();

        /// 更新数据
        /// <summary>
        /// 更新数据
        /// </summary>
        /// <returns></returns>
        bool UpdateData();

        /// 查询
        /// <summary>
        /// 查询
        /// </summary>
        bool SelectData(Dictionary<string, object> p);

        /// 查询列表数据
        /// <summary>
        /// 查询列表数据
        /// </summary>
        /// <returns></returns>
        List<T> GetDataList(Dictionary<string, object> p);

        /// datarow 转 model
        /// <summary>
        /// datarow 转 model
        /// </summary>
        /// <param name="uid"></param>
        /// <returns></returns>
        void DRChangeToModel(DataRow dr);

        /// 删除数据
        /// <summary>
        /// 删除数据
        /// </summary>
        /// <returns></returns>
        bool DeleteData(Dictionary<string, object> p);

        /// 获取同一个账号下的数据个数
        /// <summary>
        /// 获取同一个账号下的数据个数
        /// </summary>
        /// <returns></returns>
        int GetCount(Dictionary<string, object> p);
    }
}
